define(['require' , 'exports' , 'module' , 'jquery' , 'common/common' , 'layer' , 'baiduTemplate' ] ,
    function (require , exports , module , $ , common , layer) {

    let storelogin = function () {
        $('.form-submit').bind('click' , function () {
            let formData = {};
            $('.form-item').each(function(index , item){
                formData[$(item).attr('name')] = $(item).val();
            });

            common.ajaxPost('/store/login' , formData , function (error , data) {
                if(error == null && data.code == 0){
                    window.location.href = '/store/goods';
                }else if(error == null){
                    layer.msg(data.msg);
                }
            });

        });
    };


    exports.login = storelogin;

});
